;
$('.wizard .steps a').each(function () {
    $(this).off('click').on('click',function () {
        var current = $(this).parent('li');
        var currentId = $(this).attr('href');
        if (!current.hasClass('current')&&!current.hasClass('disabled')){
            current.addClass('current').removeClass('done');
            current.siblings('li.current').removeClass('current').addClass('done');
            $(currentId).removeClass('d-none');
            $(currentId).siblings('fieldset:not(.d-none)').addClass('d-none');

            if(!current.hasClass('first')){
                $('a[href="#previous"]').removeClass('d-none');
            }else{
                $('a[href="#previous"]').addClass('d-none');
            }

            if(!current.hasClass('last')){
                $('a[href="#next"]').removeClass('d-none');
                $('a[href="#next"]').next('button').addClass('d-none');
            }else{
                $('a[href="#next"]').addClass('d-none');
                $('a[href="#next"]').next('button').removeClass('d-none');
            }

        }
    });
});

$('.wizard .step-btn').each(function () {
    $(this).off('click').on('click',function () {
        var href = $(this).attr('href');

        var current = $('.wizard .steps li.current');
        current.removeClass('current').addClass('done');

        var currentId = current.find('a').attr('href');
        $(currentId).addClass('d-none');

        if(href == '#next'){

            var next = current.next('li');
            next.addClass('current').removeClass('disabled');

            var nextId = next.find('a').attr('href');
            $(nextId).removeClass('d-none');

            if(current.hasClass('first')){
                $('a[href="#previous"]').removeClass('d-none');
            }
            if(next.hasClass('last')){
                $('a[href="#next"]').addClass('d-none');
                $('a[href="#next"]').next('button').removeClass('d-none');
            }
        }else{
            var prev = current.prev('li');
            prev.addClass('current').removeClass('done');

            var prevId = prev.find('a').attr('href');
            $(prevId).removeClass('d-none');

            if(prev.hasClass('first')){
                $('a[href="#previous"]').addClass('d-none');
            }

            if(current.hasClass('last')){
                $('a[href="#next"]').removeClass('d-none');
                $('a[href="#next"]').next('button').addClass('d-none');
            }
        }
    })
});